    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
          <nav class="navbar-header">
              @foreach ($nav as $key => $value)
                  <a class="navbar-brand delete-nav" id="{{ $value->id }}"  sort="{{ $value->sort }}"  _href="{{ $value->href }}" data-toggle="modal"  data-target="#Edit_Nav" >{{ $value->name }}</a>
              @endforeach
              <a class="navbar-brand" id="0"  _href="#" data-toggle="modal" data-target="#Edit_Nav"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
              <a class="navbar-brand" id="delete-nav"  href="#"><span class="glyphicon glyphicon-minus" aria-hidden="true"></span></a>
          </nav>
          <div class="navbar-nav navbar-right">
                     <a href="#" class="navbar-brand"></a>
                     @if (empty($username))
                            <a href="{{ url('Login') }}" class="navbar-brand">登陆</a>
                     @else
                            <a href="#" class="navbar-brand dropdown-toggle" data-toggle="dropdown">{{ $username }} <span class="caret"></span></a>
                           <ul class="dropdown-menu" role="menu" style="right: auto;">
                                  <li><a href="{{ url('UserList') }}">对话
                                         <span id="badge" class="badge"></span>      
                                  </a></li>
                                  <li class="divider"></li>
                                  <li><a href="{{ url('Loginout') }}">退出</a></li>
                           </ul>
                     @endif
              </div>
        </div>
    </div>

    <!-- Modal -->
    <div class="modal fade" id="Edit_Nav" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">编辑你的Nav</h4>
          </div>
          <div class="modal-body">
              <form action="#" method="post" id="Nav">
                <div class="form-group">
                  <label for="exampleInputEmail1">Nav Name</label>
                  <input type="text" class="form-control" name="name" placeholder="请输入Nav的名称">
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">Nav Href</label>
                  <input type="text" class="form-control" name="href" placeholder="请输入Nav的链接地址">
                </div>
                <div class="form-group">
                  <label for="exampleInputPassword1">Nav Sort</label>
                  <input type="text" class="form-control" name="sort" placeholder="请输入Nav排序等级">
                </div>
                <input type="hidden" name="_method" value="PUT">
                <input type="hidden" name="_token" value="{{ csrf_token() }}">
              </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="button" class="btn btn-primary" id="Save">Save</button>
          </div>
        </div>
      </div>
    </div>
    <script type="text/javascript" >
  var nav_obj;
  $('#Edit_Nav').on('show.bs.modal', function (e) {
    // console.log(e);
    $("#Nav").attr("action","{{ url('Edit') }}/"+e.relatedTarget.id);
    nav_obj = $("#"+e.relatedTarget.id);
    if(e.relatedTarget.id != 0){
      $("input[name='name']").val(e.relatedTarget.innerText);
      $("input[name='href']").val(nav_obj.attr("_href"));
      $("input[name='sort']").val(nav_obj.attr("sort"));
    } else {
      $("input[name='name']").val('');
      $("input[name='href']").val('');
      $("input[name='sort']").val('');
    }
  });

  var isdelete = false;
  $("#delete-nav").click(function(){
    if(isdelete == false){
      $(".delete-nav").css('text-decoration','line-through');
      $(".delete-nav").css('cursor','pointer');
      $(".delete-nav").attr('data-toggle','');
      isdelete = true;
    } else {
      $(".delete-nav").css('text-decoration','none');
      $(".delete-nav").css('cursor','default');
      $(".delete-nav").attr('data-toggle','modal');
      isdelete = false;
    }
  });

  $(".delete-nav").click(function(){
    if(isdelete == true){
      var url = "{{ url('Edit') }}/"+this.id;
      $.post(url, {_method : 'DELETE', _token : '{{ csrf_token() }}'}, function (date){
        if(date.status == 1){
          location.reload();
        } else {
          alert('删除失败');
        }
      } , 'json');
    }
  });

  $("#Save").click(function(){
    $("#Nav").submit();
  });
</script>